package com.lc;


/**
 *
 * 自定义线程池
 * 任务类
 */
public class MyTask implements Runnable {

    //任务编号
    private int id ;

    public MyTask(int id){
        this.id = id;
    }

    public void run() {

        String name = Thread.currentThread().getName();
        System.out.println("线程：" + name + "即将执行任务333：" + id);

        try {
            //任务执行0.2S
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("线程：" + name + "完成了任务：" + id);


    }

    public String toString(){
        return "MyTask{" + "id = "+id+"}";
    }


}
